import React from 'react';
import { Result,Button } from 'antd';

import {createPortal} from 'react-dom'

import { useHistory } from 'react-router';
const Index = () => {

  const history = useHistory()

  const portalHtml = createPortal(<div style={{
    position: 'fixed',
    top: 0,
    left: 0,
    bottom: 0,
    right: 0,
    zIndex: '9999999999',
    backgroundColor: '#fff'
  }}>
    <Result
      status="404"
      title="404"
      subTitle="您访问的页面不存在！"
      extra={<Button type="primary" onClick={()=>{
        // 重定向
        history.replace('/')
      }}>返回首页</Button>}
    />
  </div>, document.querySelector('body'))

  return (
    <div>
      {portalHtml}
    </div>
  );
};

export default Index;
